package com.controller;


import com.controller.common.AuthKeyParam;
import com.controller.template.ResultHelper;
import com.controller.template.ResultInfo;
import com.service.ConfigService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.Objects;


/**
 * @author ruiwen
 */
@RestController
@Api(tags = "配置模块")
@CrossOrigin
@RequestMapping("/config")
public class ConfigController extends ResultHelper {
    @Resource
    ConfigService configService;

    /**
     * 获取权限配置列表
     *
     * @param
     * @return
     */
    @ApiOperation("获取权限配置列表")
    @GetMapping("/permissionList")
    public ResultInfo getPermissionList() {
        return successResultInfo(configService.getPermissionList());

    }

    /**
     * 获取权限配置列表
     *
     * @param
     * @return
     */
    @ApiOperation("更新权限配置")
    @PostMapping("/updatePermissionSwitch")
    public ResultInfo updatePermissionSwitch(@RequestBody AuthKeyParam authKeyParam) {
        configService.updatePermissionSwitch(authKeyParam.getAuthId());
        return successResultInfo("更新成功，请刷新后再看");
    }


}
